.class public Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;
.super Ljava/lang/Object;


# instance fields
.field private cDataEnabled:Z

.field private encoding:Ljava/lang/String;

.field private fileWriter:Z

.field private initInfo:Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;

.field private writer:Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;

.field private xmlContent:Ljava/lang/StringBuffer;


# direct methods
.method public constructor <init>(Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->fileWriter:Z

    iput-object p1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->initInfo:Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;

    return-void
.end method

.method private close()V
    .locals 1

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->writer:Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;

    invoke-virtual {v0}, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->close()V

    return-void
.end method


# virtual methods
.method public getEncoding()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->encoding:Ljava/lang/String;

    return-object v0
.end method

.method public getInitInfo()Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;
    .locals 1

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->initInfo:Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;

    return-object v0
.end method

.method public getXml(Ljava/lang/Object;)Ljava/lang/String;
    .locals 3

    new-instance v0, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->initInfo:Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;

    invoke-direct {v0, v1, v2}, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;-><init>(ILcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;)V

    iget-boolean v1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->cDataEnabled:Z

    invoke-virtual {v0, v1}, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;->setCdataEnabled(Z)V

    invoke-virtual {v0, p1}, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;->process(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->writeXmlContent(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->xmlContent:Ljava/lang/StringBuffer;

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public isCDataEnabled()Z
    .locals 1

    iget-boolean v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->cDataEnabled:Z

    return v0
.end method

.method public saveXml(Ljava/lang/Object;Ljava/lang/String;)V
    .locals 3

    new-instance v0, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->initInfo:Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;

    invoke-direct {v0, v1, v2}, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;-><init>(ILcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;)V

    iget-boolean v1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->cDataEnabled:Z

    invoke-virtual {v0, v1}, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;->setCdataEnabled(Z)V

    const/4 v1, 0x1

    iput-boolean v1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->fileWriter:Z

    new-instance v1, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;

    invoke-direct {v1, p2}, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;-><init>(Ljava/lang/String;)V

    iput-object v1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->writer:Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;

    invoke-virtual {v0, p1}, Lcom/wqmobile/sdk/pojoxml/core/processor/pojotoxml/ClassToXmlProcessor;->process(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->writeXmlContent(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->writer:Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;

    invoke-virtual {v0}, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->close()V

    return-void
.end method

.method public setCDataEnabled(Z)V
    .locals 0

    iput-boolean p1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->cDataEnabled:Z

    return-void
.end method

.method public setEncoding(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->encoding:Ljava/lang/String;

    return-void
.end method

.method public setInitInfo(Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;)V
    .locals 0

    iput-object p1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->initInfo:Lcom/wqmobile/sdk/pojoxml/core/PojoXmlInitInfo;

    return-void
.end method

.method public writeXmlContent(Ljava/lang/String;)V
    .locals 3

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->xmlContent:Ljava/lang/StringBuffer;

    if-nez v0, :cond_0

    new-instance v0, Ljava/lang/StringBuffer;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "<?xml version=\"1.0\" encoding=\""

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v2, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->encoding:Ljava/lang/String;

    invoke-static {v2}, Lcom/wqmobile/sdk/pojoxml/util/XmlUtil;->getEncoding(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "\"?>"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuffer;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->xmlContent:Ljava/lang/StringBuffer;

    :cond_0
    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->xmlContent:Ljava/lang/StringBuffer;

    invoke-virtual {v0, p1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    iget-boolean v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->fileWriter:Z

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->writer:Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;

    iget-object v1, p0, Lcom/wqmobile/sdk/pojoxml/core/processor/PojoToXml;->xmlContent:Ljava/lang/StringBuffer;

    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/wqmobile/sdk/pojoxml/util/XmlWriter;->write(Ljava/lang/String;)V

    :cond_1
    return-void
.end method
